package com.lp.compt.pojo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "ss_results")
public class SsResultsEntity {
    private Integer rId;
    private Integer idCompettion;
    private String cSubject;
    private String cResult;
    private Integer idUser;
    private String rZkzh;
    private Integer status;
    private SsCompetitionEntity ssCompetitionEntity;
    private SysUserEntity sysUserEntity;


    @Id
    @Column(name = "r_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getrId() {
        return rId;
    }

    public void setrId(Integer rId) {
        this.rId = rId;
    }

    @Basic
    @Column(name = "id_compettion")
    public Integer getIdCompettion() {
        return idCompettion;
    }

    public void setIdCompettion(Integer idCompettion) {
        this.idCompettion = idCompettion;
    }

    @Basic
    @Column(name = "c_subject")
    public String getcSubject() {
        return cSubject;
    }

    public void setcSubject(String cSubject) {
        this.cSubject = cSubject;
    }

    @Basic
    @Column(name = "c_result")
    public String getcResult() {
        return cResult;
    }

    public void setcResult(String cResult) {
        this.cResult = cResult;
    }

    @Basic
    @Column(name = "id_user")
    public Integer getIdUser() {
        return idUser;
    }

    public void setIdUser(Integer idUser) {
        this.idUser = idUser;
    }

    @OneToOne
    @JoinColumn(name = "id_compettion", referencedColumnName = "id", insertable = false, updatable = false)
    public SsCompetitionEntity getSsCompetitionEntity() {
        return ssCompetitionEntity;
    }

    public void setSsCompetitionEntity(SsCompetitionEntity ssCompetitionEntity) {
        this.ssCompetitionEntity = ssCompetitionEntity;
    }

    @OneToOne
    @JoinColumn(name = "id_user", referencedColumnName = "id", insertable = false, updatable = false)
    public SysUserEntity getSysUserEntity() {
        return sysUserEntity;
    }

    public void setSysUserEntity(SysUserEntity sysUserEntity) {
        this.sysUserEntity = sysUserEntity;
    }

    @Basic
    @Column(name = "r_skzh")
    public String getrZkzh() {
        return rZkzh;
    }

    public void setrZkzh(String rZkzh) {
        this.rZkzh = rZkzh;
    }


    @Basic
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SsResultsEntity that = (SsResultsEntity) o;
        return rId == that.rId && idCompettion == that.idCompettion && Objects.equals(cSubject, that.cSubject) && Objects.equals(cResult, that.cResult) && Objects.equals(idUser, that.idUser);
    }

    @Override
    public int hashCode() {
        return Objects.hash(rId, idCompettion, cSubject, cResult, idUser);
    }
}
